using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using Microsoft.Xna.Framework.Net;
using Microsoft.Xna.Framework.Storage;

namespace HandlingInput
{
    public class EventHandle
    {

        public static KeyboardState _currenkeyBoard;
        public static KeyboardState _prekeyBoard;

        public static MouseState _currentMouse;
        public static MouseState _preMouse;

        public static void Update()
        {
            _preMouse = _currentMouse;
            _currentMouse = Mouse.GetState();

            _prekeyBoard = _currenkeyBoard;
            _currenkeyBoard = Keyboard.GetState();

        }

        public static bool MouseLeftClick(Rectangle rect)
        {
            
            if (_currentMouse.X >= rect.X && _currentMouse.X <= (rect.X + rect.Width) && _currentMouse.Y >= rect.Y && _currentMouse.Y <= (rect.Y + rect.Height) && _currentMouse.LeftButton == ButtonState.Pressed)
                return true;
            return false;
        }

        public static bool MouseOver(Rectangle Rect)// Mouse_Over
        {
            if (_currentMouse.X >= Rect.X && _currentMouse.X <= (Rect.X + Rect.Width) && _currentMouse.Y >= Rect.Y && _currentMouse.Y <= (Rect.Y + Rect.Height))
                return true;
            return false;
        }

        public static bool MouseLeftRelease()
        {
            if (_currentMouse.LeftButton == ButtonState.Released)
                return true;
            return false;
        }
    }
}
